package com.itheima.util;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.Date;

public class TimeUtil {

    public static long calculate() {
        //判断当前时间距离0点还有多久
        //获取当前时间毫秒值
        long currentTime = System.currentTimeMillis();
        //获取今日零点的毫秒值
        DateTime endOfDay = DateUtil.endOfDay(new Date(currentTime));
        long endTime = endOfDay.getTime();
        //计算当前离今晚还有多少秒
        return (endTime-currentTime)/1000;
    }
}
